package com.redrose.demo.fragment;

import androidx.recyclerview.widget.RecyclerView;

import com.redrose.demo.R;
import com.redrose.demo.base.BaseFragment;
import com.redrose.demo.bean.ListItem;
import com.redrose.demo.databinding.FragmentHomeBinding;

import java.util.ArrayList;
import java.util.List;

public class HomeFragment extends BaseFragment<FragmentHomeBinding> {
    public static final int ITEM_TITLE = 0;
    public static final int ITEM_INFO = 1;
    public static final int ITEM_IMAGE = 2;
    @Override
    protected void initView() {
        RecyclerView mRecyclerView = mBind.homeRecyclerView;
        List<ListItem> list = new ArrayList<>();
        ListItem titleItem = new ListItem(ITEM_TITLE,R.layout.home_title_layout);
        ListItem infoItem = new ListItem(ITEM_INFO,R.layout.home_info_layout);
        ListItem imageItem = new ListItem(ITEM_IMAGE,R.layout.home_image_layout);
        list.add(titleItem);
        list.add(infoItem);
        list.add(imageItem);
        HomeAdapter adapter = new HomeAdapter(list);
        mRecyclerView.setAdapter(adapter);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_home;
    }
}
